package cn.chahuyun;

/**
 * ShapeFactory
 *
 * @author Moyuyanli
 * @date 2023/11/24 9:32
 */
public class ShapeFactory {

    //使用 getShape 方法获取形状类型的对象
    public Shape getShape(String shapeType){
        if(shapeType == null){
            return null;
        }
        if(shapeType.equalsIgnoreCase("圆")){
            return new Circle();
        } else if(shapeType.equalsIgnoreCase("矩形")){
            return new Rectangle();
        } else if(shapeType.equalsIgnoreCase("方形")){
            return new Square();
        }
        return null;
    }
}
